<template>
  <view class="page-login-index">
    <view class="logo">
      <!-- <van-image :src="logo" fit="contain" width="200rpx" height="200rpx" /> -->
      <view class="ftb-24">运输管理平台</view>
      <view>司机端</view>
    </view>
    <van-cell-group inset :border="false" class="form">
      <van-field :value="form.phone" placeholder="请输入手机号码" clearable :border="false" @input="e => form.phone = e.detail" />
      <van-field :value="form.password" placeholder="请输入密码" clearable :border="false" type="password" @input="e => form.password = e.detail" />
    </van-cell-group>
    <view class="p-a-15">
      <van-button type="info" size="large" block round :disabled="valid.phone == false || valid.password == false || valid.checked == false">登录</van-button>
    </view>
    <view class="c-grey align-center" @tap="$refs.resetPassword.init()">
      忘记密码？
    </view>
    <view class="service">
      <van-checkbox :value="valid.checked" :icon-size="16" @change="$event => {valid.checked = !valid.checked}">我已阅读并同意</van-checkbox>
      <view class="agreement"><text class="c-blue">《用户协议》</text>、<text class="c-blue">《隐私条款》</text></view>
    </view>
    <reset-password ref="resetPassword" />
  </view>
</template>

<script>
import resetPassword from './components/resetPassword';
import {api_url, tenant_id} from '@/static/js/config';
export default {
  data(){
    return{
      logo: this.$icon.logo ,//require('@/static/img/icon-logo2.png'),
      loading: false,
      form:{
        phone: null,
        password: null,
      },
      valid:{
        phone: false,
        password: false,
        checked: false,
      }
    }
  },
  components:{
    resetPassword
  },
  watch:{ 
			'form.phone'(newVal,oldVal){
				var isValid = /^1[0-9]{10}$/.test(newVal);
				this.valid.phone = isValid;				
			},
			'form.password'(newVal,oldVal){
				var isValid = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,15}$/.test(newVal);
				this.valid.password = isValid;				
			},
		},
  onLoad(){
    let info = uni.getSystemInfoSync();
    this.contentHeight = info.windowHeight - 244;
  },
  methods:{
    

  }
}
</script>

<style>

</style>